<%-- 
    Document   : cadFornecedor
    Created on : 11/03/2011, 15:36:13
    Author     : UpTech
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!-- Declaração das Tags da biblioteca RichFaces -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <style>.cols{
            vertical-align:top;

        }
        
    </style>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link href="../css/estilomodelo.css" rel="stylesheet" type="text/css" />

            <title>CADASTRO DE FORNECEDOR | Sistema Gestão de Suprimentos - SGS 1.0</title>
        </head>
        <body>
            <div id="container">
                <div id="banner">
                </div><%--Banner--%>
                <div  id="conteudoCad">
                    <h:form>
                        <rich:tabPanel switchType="client" style="width:752px; height:200px; background-color:#EEEEEE;">
                            <rich:tab label="Dados Pessoais">
                                <f:facet name="header">
                                    <h:outputText value="Cadastro de Fornecedor" ></h:outputText>
                                </f:facet>
                                <h:panelGrid cellpadding="4" columns="2">
                                    <h:panelGrid  columns="3">
                                        <h:outputText  value="CNPJ: "/>
                                        <rich:inplaceInput inputWidth="70" id="cnpj" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.cnpj}" defaultLabel="CNPJ" required="true" maxInputWidth="18"/>
                                        <rich:message for="cnpj"/>

                                        <h:outputText value="Insc. Estadual: "/>
                                        <rich:inplaceInput inputWidth="70" id="insc" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.insEstadual}" defaultLabel="Insc. Estadual" required="true" />
                                        <rich:message for="insc"/>

                                        <h:outputText value="Razão Social: "/>
                                        <rich:inplaceInput inputWidth="70" id="razaosocial" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.razaoSocial}" defaultLabel="Razão Social" required="true" />
                                        <rich:message for="razaosocial"/>

                                        <h:outputText value="Nome Fantasia: "/>
                                        <rich:inplaceInput inputWidth="70" id="nfantasia" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.nomeFantasia}" defaultLabel="Nome Fantasia" required="true" />
                                        <rich:message for="nfantasia"/>

                                        <h:outputText  value="UF: "/>
                                        <rich:comboBox id="uf"  defaultLabel="uf"  value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.uf}" required="true">
                                            <f:selectItems value="#{ObjDAO.ufs}"/>
                                        </rich:comboBox>
                                        <rich:message for="uf"/>

                                        <h:outputText value="Cidade: "/>
                                        <rich:inplaceInput inputWidth="70" id="cidade" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.cidade}" defaultLabel="Cidade" required="true" />
                                        <rich:message for="cidade"/>
                                    </h:panelGrid>

                                    <h:panelGrid columns="3">
                                        
                                        <h:outputText value="Bairro: "/>
                                        <rich:inplaceInput inputWidth="70" id="bairro" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.bairro}" defaultLabel="Bairro" required="true" />
                                        <rich:message for="bairro"/>

                                        <h:outputText value="Rua: "/>
                                        <rich:inplaceInput inputWidth="70" id="rua" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.rua}" defaultLabel="Rua" required="true" />
                                        <rich:message for="rua"/>

                                         <h:outputText value="CEP: "/>
                                        <rich:inplaceInput id="cep" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.cep}" defaultLabel="CEP" required="true" />
                                        <rich:message for="cep"/>

                                        <h:outputText value="Fone "/>
                                        <rich:inplaceInput inputWidth="70" id="fone" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.fone}" defaultLabel="Fone" required="true" />
                                        <rich:message for="fone"/>

                                        <h:outputText value="Email "/>
                                        <rich:inplaceInput inputWidth="70" id="email" value="#{ObjFacadeFornecedor.fornecedor.pessoaJuridica.email}" defaultLabel="Email" required="true" />
                                        <rich:message for="email"/>
                                    </h:panelGrid>

                                   

                                </h:panelGrid>
                            </rich:tab>

                            <rich:tab label="Dados Fornecedor">
                                <h:panelGrid columns="3">                               

                                    <h:outputText value="Contato "/>
                                    <rich:inplaceInput id="contato" value="#{ObjFacadeFornecedor.fornecedor.contato}" defaultLabel="Contato" required="true" />
                                    <rich:message for="contato"/>

                                    <h:outputText value="Fax "/>
                                    <rich:inplaceInput id="fax" value="#{ObjFacadeFornecedor.fornecedor.fax}" defaultLabel="Fax" required="true" />
                                    <rich:message for="fax"/>

                                <a4j:commandButton value="Cadastro" action="#{ObjFacadeFornecedor.cadastrarFornecedor}" />
                                </h:panelGrid>
                            </rich:tab>
                        </rich:tabPanel>
                    </h:form>
                </div><%--Conteúdo--%>
                <div align="center" id="tableCad">
                    <h:form>
                        <rich:dataTable style="width:740px;" id="fornecedor" border="1" value="#{ObjDAO.allFornecedor}" rendered="#{not empty ObjDAO.allFornecedor}"  var="f" rows="4">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Id"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.idFornecedor}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="CNPJ"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.cnpj}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Insc. Estadual"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.insEstadual}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Nome Fantasia"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.nomeFantasia}"/></center>
                            </h:column>
                             <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Uf"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.uf}"/></center>
                            </h:column>
                             <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Cidade"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.cidade}"/></center>
                            </h:column>
                             <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Bairro"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.bairro}"/></center>
                            </h:column>
                             <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Obra"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.rua}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="CEP"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.cep}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Fone"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.fone}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Email"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.pessoaJuridica.email}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Contato"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.contato}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Fax"/>
                                </f:facet>
                                <center> <h:outputText value="#{f.fax}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Excluir"/>
                                </f:facet>
                                <center> <h:commandButton value="excluir" action="#{ObjFacadeFornecedor.excluirFornecedor}" image="../imagens/icon/excluir.gif" ></center>
                                    <f:setPropertyActionListener target="#{ObjFacadeFornecedor.fornecedor}" value="#{f}"/>
                                </h:commandButton>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Alterar"/>
                                </f:facet>
                                <center> <h:commandButton value="alterar" action="editar" image="../imagens/icon/alterar.gif" ></center>
                                    <f:setPropertyActionListener target="#{ObjFacadeFornecedor.fornecedor}" value="#{f}"/>
                                </h:commandButton>
                            </h:column>
                            <f:facet name="footer">
                                <rich:datascroller />
                            </f:facet>
                        </rich:dataTable>
                    </h:form>
                </div><%--Tabela--%>
                <div id="rodapelogin">
                </div><%--Rodapé--%>
            </div><%--Container--%>
        </body>
    </html>

</f:view>
